//
//  XJLabelLabelCell.m
//  XinJiangMall
//
//  Created by RaoBo on 2018/5/21.
//  Copyright © 2018年 Tzyang. All rights reserved.
//

#import "XJLabelLabelCell.h"
@interface XJLabelLabelCell()
@property(nonatomic, strong) UILabel *leftTitleLabel;
@property(nonatomic, strong) UILabel *rightContentLabel;



@end

@implementation XJLabelLabelCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

#pragma mark - 一 初始化
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        [self setupView];
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;

    }
    return self;
}

- (void)setupView {
    [self addSubview:self.leftTitleLabel];
    [self addSubview:self.rightContentLabel];
}

#pragma mark - 二 lazy
- (UILabel *)leftTitleLabel {
    if (!_leftTitleLabel) {
        _leftTitleLabel = [[UILabel alloc] init];
//        _leftTitleLabel.backgroundColor = [UIColor redColor];
        _leftTitleLabel.text = @"地址";
    }
    return _leftTitleLabel;
}

- (UILabel *)rightContentLabel {
    if (!_rightContentLabel) {
        _rightContentLabel = [[UILabel alloc] init];
        _rightContentLabel.text = @"请选择"; // 默认
       _rightContentLabel.textColor = XJCOLOR_RGB(199, 199, 204);
//        _rightContentLabel.backgroundColor = [UIColor redColor];
        
        _rightContentLabel.numberOfLines = 0; // 希望高度自适应
    }
    return _rightContentLabel;
}


#pragma mark - 三 layou
- (void)layoutSubviews {
    [super layoutSubviews];
    
    [self.leftTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.left.equalTo(self.mas_left).offset(15);
        make.centerY.equalTo(self.mas_centerY);
        make.width.mas_equalTo(CGSizeMake(100, 30));
    }];
    
    [self.rightContentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.leftTitleLabel.mas_right).offset(15);
        make.centerY.equalTo(self.mas_centerY);
        make.width.mas_equalTo(150); // 高度自适应
    }];
}

#pragma mark - 四 接口
- (void)configLabelLabelCellWithAddress:(NSString *)address {
    
    // 非空的时候进行赋值
    if (![NSString isEmptyString:address]) {
        self.rightContentLabel.text = address;
    }
}


@end
